# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

_pkgname=aiopg
pkgname=python-$_pkgname
pkgver=1.4.0
pkgrel=2
pkgdesc='library for accessing a PostgreSQL database from the asyncio'
arch=('any')
url='https://github.com/aio-libs/aiopg'
license=('BSD')
depends=('python' 'python-psycopg2' 'python-async-timeout')
makedepends=('python-build' 'python-installer' 'python-wheel'
             'python-setuptools' 'python-setuptools-scm')
optdepends=('python-sqlalchemy: SQLAlchemy support')
#checkdepends=('python-pytest-runner' 'python-sqlalchemy' 'python-docker')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha512sums=('cbb28b0b15eb89fa3162e59e3e88dac18bddbad3d95458b5c3eb487d15767c26810e941f83c3478cac8a8a085b23723690c8d294bf6aac433a14c3defcef1138')

# TODO: fix tests (need docker)

prepare() {
  sed -i 's|install_requires = \["psycopg2-binary|install_requires = \["psycopg2|' $_pkgname-$pkgver/setup.py
}

build() {
  cd $_pkgname-$pkgver

  python -m build
}

#check() {
#  cd $_pkgname-$pkgver
#
#  python setup.py pytest
#}

package() {
  cd $_pkgname-$pkgver

  python -m installer -d "$pkgdir" dist/*.whl

  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
